#include "bits/stdc++.h"
using namespace std;

int main(int argc, char* argv[]){

    int N;
    cin>>N;

    vector<int> nums(N, 0);
    for(int i=0; i<N; i++){
        cin>>nums[i];
    }

    int operates = 0;
    long long sum = nums[N-1];
    for(int i=N-2; i>=0; i--){
        if(nums[i+1] > nums[i]){
            nums[i] = nums[i+1];
            operates++;
        }
        sum += nums[i];
    }
    cout<< sum << " " << operates <<endl;

    return 0;
}